package com.agm.android.fragments;

import android.app.Fragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.agm.dto.Utente;
import com.example.android.navigationdrawerexample.App;
import com.example.android.navigationdrawerexample.R;

public class AccountFragment extends Fragment {
	public static final String ARG_PLANET_NUMBER = "planet_number";
	private Utente utente = new Utente();
	public AccountFragment() {
		// Empty constructor required for fragment subclasses
	}

	
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,Bundle savedInstanceState) {
		View rootView = inflater.inflate(R.layout.fragment_account, container,false);
		
		//App.utente = httpClient.getUtente("alberto645","otrebla1983");
		if(App.utente != null){
			TextView nome = (TextView) rootView.findViewById(R.id.nomeValue);
			TextView cognome = (TextView) rootView.findViewById(R.id.cognomeValue);
			TextView username = (TextView) rootView.findViewById(R.id.usernameValue);
			TextView legaPrivata = (TextView) rootView.findViewById(R.id.legaprivataValue);
			TextView legaPubblica = (TextView) rootView.findViewById(R.id.legapubblicaValue);
			nome.setText(App.utente.getNome());
			cognome.setText(App.utente.getCognome());
			username.setText(App.utente.getUserid());
			legaPrivata.setText("" + App.utente.getIdlegaprivata());
			legaPubblica.setText("" + App.utente.getIdlegapubblica());
		}
		return rootView;
	}

	public Utente getUtente() {
		return utente;
	}

	public void setUtente(Utente utente) {
		this.utente = utente;
	}
	
}
